# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=libharu
pkgver=2.4.4
pkgrel=0
pkgdesc="C library for generating PDF documents"
url="https://github.com/libharu/libharu"
arch="all"
license="custom"
depends_dev="libpng-dev"
makedepends="$depends_dev cmake samurai"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/libharu/libharu/archive/refs/tags/v$pkgver.tar.gz"
options="!check" # no tests

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DLIBHPDF_STATIC=OFF
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/libharu/LICENSE"

	# remove useless files
	rm -rf "$pkgdir"/usr/share/libharu
}

sha512sums="
422210b09f89643cb25808559aeea109db5cce8a71c779d51f87222cdd50434f4f0f92322ebe429fca8f85ad73592bcabb14c3e36cd0bea19b6ec4c729220522  libharu-2.4.4.tar.gz
"
